<template>
	<div id='XQTJchart' style="width: 680px;height:280px;margin:0 auto;"></div>
</template>

<script>
import * as echarts from 'echarts'
import {WEEKTASKSTATISTIC} from '@/../static/js/apis.js'

export default{
	name: "XQTJchart",
	methods: {
		//绘制图形
		drawChart (data,day) {
			let myChart = echarts.init(document.getElementById('XQTJchart'))
			let options = {
			    title: {
			        text: '近七日需求提交数',
			        left: 'left'
			    },
			    tooltip: {
			        trigger: 'item'
			    },
			    xAxis: {
			        type: 'category',
			        data: day
			    },
			    yAxis: {
			        type: 'value'
			    },
			    series: [{
			        data: data,
			        type: 'line',
			        smooth: true
			    }]
			};
			myChart.setOption(options, true)
		},
		getData () {
			const self = this;
			WEEKTASKSTATISTIC('',function(res){
				if(res.obj){
					//绘制图形
					self.drawChart(res.obj.data,res.obj.day);
				}
			})
		}
	},
	mounted () {
		this.getData();
	}
}
	
</script>

<style scoped>
	
</style>